<?php /*a:3:{s:69:"D:\projects\original_admin\app\merchant\view\order\refund_detail.html";i:1754753167;s:61:"D:\projects\original_admin\app\merchant\view\common\base.html";i:1752764603;s:63:"D:\projects\original_admin\app\merchant\view\common\header.html";i:1754830154;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="renderer" content="webkit" />
	<meta name="force-rendering" content="webkit" />
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>管理系统</title>
	<script src="/static/merchant/js/jquery-min.js"></script>
	<link rel="stylesheet" href="/static/merchant/layui/css/layui.css">
	<script type="text/javascript" src="/static/merchant/layui/layui.js"></script>
	<link rel="stylesheet/less" type="text/css" href="/static/merchant/css/index.less" />
	<script src="/static/merchant/js/less.js"></script>
    
</head>
<body>
	<main class="CenterMain">
		<header class="Header">
    <div class="logo img_box">
        <img src="/static/merchant/images/logow.png">

    </div>
    <div class="top">
        <ul class="nav-buttons">
            <li id="toggle-btn">

                <span class="desktop-text layui-icon layui-icon-spread-left">
                </span>
                <span class="mobile-text">菜单</span>
            </li>
        </ul>
        <dl class="menu-btn">
            <a class="img_box ">
                <img src="/static/merchant/images/head1.png">
                <i class="msg"></i>
            </a>
            <a class="img_box">
                <img src="/static/merchant/images/head2.png">
            </a>
        </dl>
        <span class="hr"></span>
        <ul class="layui-nav">

            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;">
                    <img  src="<?php echo htmlentities((string) (isset($userInfo['shop_thumb']) && ($userInfo['shop_thumb'] !== '')?$userInfo['shop_thumb']:'/static/merchant/images/sign-user.png')); ?>" class="layui-nav-img">
                    <span><?php echo htmlentities((string) $userInfo['shop_name']); ?></span>
                </a>
                <dl class="layui-nav-child">
                    <!-- <dd><a href="account_info.html">个人信息</a></dd> -->
                    <dd><a href="/merchant/account_pwd.html">密码修改</a></dd>
                    <dd style="text-align: center;"><a href="/merchant/login_out">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

</header>
<div class="Sidebar" id="sidebar">
    <ul class="menu">
        <li class="menu-item">
            <div lay-on="url" href="/" class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav22.png">
                    <img class="img2" src="/static/merchant/images/nav21.png">
                </div>
                <span>商品管理</span>
                <!-- <i class="layui-icon layui-icon-right"></i> -->
            </div>
        </li>
        <li class="menu-item <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav32.png">
                    <img class="img2" src="/static/merchant/images/nav31.png">
                </div>
                <span>订单管理</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>
            <dl    <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?> >
                <dd>
                    <a href="/merchant/order.html"  <?php if($routers == 'order/list'): ?>  class="active" <?php endif; ?> >订单管理</a>
                </dd>
                <dd>
                    <a href="/merchant/shop_back.html" <?php if($routers == 'order/shop_back'): ?>  class="active" <?php endif; ?>>退货管理</a>
                </dd>
                <dd>
                    <a href="/merchant/review.html" <?php if($routers == 'order/review'): ?>  class="active" <?php endif; ?>>订单评价</a>
                </dd>

            </dl>

        </li>
        <li class="menu-item <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav42.png">
                    <img class="img2" src="/static/merchant/images/nav41.png">
                </div>
                <span>财务提现</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl  <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'finance/finance_cash'): ?>  class="active" <?php endif; ?> href="/merchant/finance_cash.html">提现</a>
                </dd>
                <dd>
                    <a  <?php if($routers == 'finance/finance_logs'): ?>  class="active" <?php endif; ?> href="/merchant/finance_logs.html">记录</a>
                </dd>
            </dl>

        </li>
        <!-- <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="images/nav52.png">
                    <img class="img2" src="images/nav51.png">
                </div>
                <span>消息中心</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

        </li> -->
        <li class="menu-item <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav62.png">
                    <img class="img2" src="/static/merchant/images/nav61.png">
                </div>
                <span>店铺设置</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'store/store_info'): ?>  class="active" <?php endif; ?> href="/merchant/store_info.html">店铺信息 </a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_notice'): ?>  class="active" <?php endif; ?> href="/merchant/store_notice.html">店铺公告</a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_model'): ?>  class="active" <?php endif; ?>  href="/merchant/store_model.html">运费模板</a>
                </dd>
            </dl>

        </li>
    </ul>
</div>
		 
<style>
    .layui-form-label{
        width: 100px;
    }
</style>
<div class="Content" id="content">
    <div class="ContactPage  OrderInfo">
        <div class="title-tag">退款详情</div>
        <div class="order-container">
            <div class="order-info">
                <div>

                    <span>订单号：<?php echo htmlentities((string) $order['order_id']); ?></span>
                    <!-- <span><i class="layui-icon layui-icon-print"></i>打印订单</span> -->
                </div>
                <div>
                    <span>支付方式：
                        <?php if($order['pay_type'] == 1): ?>微信支付
                        <?php elseif($order['pay_type'] == 2): ?>余额支付
                        <?php else: ?>其他
                        <?php endif; ?>
                    </span>
                    <!-- <span>订单状态：<?php echo htmlentities((string) $order['status_name']); ?></span> -->
                </div>

            </div>
            <h5>订单信息</h5>
            <div class="progress-steps">
                <div class="steps-wrapper">
                    <div class="step active">
                        <div class="step-circle">1</div>
                        <div class="step-text">提交订单<br><?php echo htmlentities((string) $order['add_time']); ?></div>
                    </div>
                    <div class="step active">
                        <div class="step-circle">2</div>
                        <div class="step-text">订单支付
                            <?php if($order['pay_time'] > 0): ?><?php echo htmlentities((string) date("Y-m-d H:i:s",!is_numeric($order['pay_time'])? strtotime($order['pay_time']) : $order['pay_time'])); ?><?php endif; ?>
                        </div>
                    </div>
                    <div class="step <?php if($order['status'] > 1): ?> active <?php endif; ?>">
                        <div class="step-circle">3</div>
                        <div class="step-text">商品已发货<br>
                            <?php if($order['deliver_time'] > 0): ?><?php echo htmlentities((string) $order['deliver_time']); ?><?php endif; ?>
                        </div>
                    </div>
                    <div class="step <?php if($order['status'] >= 4): ?> active <?php endif; ?>">
                        <div class="step-circle">4</div>
                        <div class="step-text">退货退款申请<br>
                        </div>
                    </div>
                    <div class="step <?php if($order['status'] >= 4): ?> active <?php endif; ?>">
                        <div class="step-circle">5</div>
                        <div class="step-text">商家处理</div>
                    </div>
                    <div class="step <?php if($order['status'] >= 4 && $order['refund_express']): ?> active <?php endif; ?>">
                        <div class="step-circle">6</div>
                        <div class="step-text">商品寄回</div>
                    </div>
                    <!-- <div class="step">
                        <div class="step-circle">7</div>
                        <div class="step-text">确认商品</div>
                    </div> -->
                    <div class="step <?php if($order['status'] == 5): ?> active <?php endif; ?>">
                        <div class="step-circle">7</div>
                        <div class="step-text">退款</div>
                    </div>
                    <div class="step <?php if($order['status'] == 5 || $order['status'] == 6 || $order['status'] == 7): ?> active <?php endif; ?>">
                        <div class="step-circle">8</div>
                        <div class="step-text">完成</div>
                    </div>
                </div>
            </div>
            <!-- 收货 & 开票信息 -->
            <ul class="info-row">
                <li>
                    <div class="title">收货信息</div>

                    <dl>
                        <dd>收货人: <?php echo htmlentities((string) $order['real_name']); ?> </dd>
                        <dd> 收货电话: <?php echo htmlentities((string) $order['user_phone']); ?></dd>
                        <dd> 收货地址: <?php echo htmlentities((string) $order['user_address']); ?></dd>
                    </dl>

                </li>

                <li>
                    <div class="title">退回物流</div>

                    <dl>
                        <dd>退货单号：<?php echo htmlentities((string) $order['refund_express']); ?> </dd>
                        <dd> 退款金额：{order.refund_price} </dd>
    
                    </dl>

                </li>

                <!-- <li>
                    <div class="title">开票信息</div>

                    <dl>
                        <dd>发票类型：数电普票 </dd>
                        <dd> 发票拍头：深XXXXXXXXXXXXXXXXXXXXX</dd>
                        <dd> 纳税人识别号：91440300088583334H</dd>
                        <dd> 收票邮箱:13737732458@163.com</dd>
                    </dl>

                </li> -->
            </ul>

            <!-- 商品信息表格 -->
            <div class="section-title"><i></i>全部</div>
            <div class="table-view">
                <table class="goods-table layui-tab">
                    <thead>
                        <tr>
                            <th>商品信息</th>
                            <th>单价（元）</th>
                            <th>数量</th>
                            <th>小计（元）</th>
                            <!-- <th>状态</th> -->
                        </tr>
                    </thead>
                    <tbody>
                        <?php if(is_array($order['cartDetail']) || $order['cartDetail'] instanceof \think\Collection || $order['cartDetail'] instanceof \think\Paginator): $i = 0; $__LIST__ = $order['cartDetail'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cart): $mod = ($i % 2 );++$i;?> 
                                <tr>
                                    <td>
                                        <div class="shopName">

                                            <div class="img_100 img">
                                                <img src="<?php echo htmlentities((string) $cart['cart_info']['thumb']); ?>">
                                            </div>
                                            <div class="text">
                                                <b> <?php echo htmlentities((string) $cart['cart_info']['productInfo']['store_name']); ?> <?php echo htmlentities((string) $cart['cart_info']['productInfo']['attrInfo']['suk']); ?></b>
                                                <br> <br>
                                            </div>
                                        </div>

                                    </td>
                                    <td>¥<?php echo htmlentities((string) $cart['cart_info']['productInfo']['price']); ?></td>
                                    <td><?php echo htmlentities((string) $cart['cart_info']['cart_num']); ?></td>
                                    <td>

                                        <b class="ftc">¥<?php echo htmlentities((string) $cart['cart_info']['productInfo']['price']); ?> * <?php echo htmlentities((string) $cart['cart_info']['cart_num']); ?></b>
                                    </td>
                                    <!-- <td>
                                        <b class="ftc"><?php echo htmlentities((string) $order['status_name']); ?></b>
                                    </td> -->
                                </tr>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>
            </div>
            <div class=" amount-summary">
                <div class="item">
                    <span class="label">商品总件数：</span>
                    <span class="num" style="color: #ff4d4f;"><?php echo htmlentities((string) $order['total_num']); ?>件</span>
                </div>
            </div>
            <div class="amount-summary grid-row">
                <div class="md4 xs12">
                    <p>运费：<strong>¥<?php echo htmlentities((string) $order['freight_price']); ?></strong></p>
                </div>
                <div class="md4 xs12">
                    <p>优惠：<strong>¥<?php echo htmlentities((string) $order['deduction_price']); ?></strong></p>
                </div>

                <div class="item md4 xs12">
                    <span class="label">商品应付总额：</span>
                    <strong class="num">¥<?php echo htmlentities((string) $order['pay_price']); ?></strong>
                </div>

            </div>

            <!-- 物流信息 -->
            <div class="section-title"><i></i>物流信息</div>
            <div class="logistics-info">
                <ul class="logistics-list">
                    <div class="logistics-item">
                        <span>物流公司：</span><?php echo htmlentities((string) $order['delivery_name']); ?>
                    </div>
                    <div class="logistics-item">
                        <span>运单号：</span><?php echo htmlentities((string) $order['delivery_id']); ?>
                    </div>
                    <div class="logistics-item">
                        <span>发货时间：</span><?php echo htmlentities((string) $order['deliver_time']); ?>
                    </div>
                </ul>


                <div class="logistics-timeline">
                    <div class="timeline-item">
                        <div class="timeline-date">2024-05-10</div>
                        <div class="timeline-time">04:25:47</div>
                        <div class="timeline-content">[深圳市]<span style="color: #29A370;"> [深圳市]快件已发往
                                [安徽合肥转运中心]</span></div>
                    </div>
                    <div class="timeline-item">
                        <div class="timeline-date"></div>
                        <div class="timeline-time">04:25:16</div>
                        <div class="timeline-content">[深圳市] [深圳市]快件已到达 [广东深圳转运中心]</div>
                    </div>
                    <div class="timeline-item">
                        <div class="timeline-date"></div>
                        <div class="timeline-time">03:39:55</div>
                        <div class="timeline-content">[深圳市] [深圳市]快件已发往 [广东深圳转运中心]</div>
                    </div>

                    <div class="timeline-item">
                    </div>
                    <div class="timeline-item">
                        <div class="timeline-date">2024-05-10</div>
                        <div class="timeline-time">22:06:59</div>
                        <div class="timeline-content">[东莞市] [东莞市] [广东东莞莞长安镇公司] (0769-23883755)的长营业部徐除名已收件
                        </div>
                    </div>
                </div>

                <div class="notice">
                    以上信息由物流公司提供，如无跟踪信息或有疑问，请咨询平台
                </div>

                <!-- <div class="action-foot-btns">
                    <button class="layui-btn">物流异常处理</button>
                    <button class="layui-btn">填写物流信息</button>
                </div> -->
            </div>

            <div class="section-title"><i></i> 退款理由</div>
            <div class="back-info">
                <b style="color: #FF0F0F;"><?php echo htmlentities((string) $order['refund_reason_wap']); ?>
                </b>

                <p><?php echo htmlentities((string) $order['refund_reason_wap_explain']); ?></p>
                <div style="margin-top: 20px;">
                    <?php if($order['refund_reason_wap_img']): 
                            // 将逗号分隔的图片字符串转为数组
                            $refundImages = explode(',', $order.refund_reason_wap_img);
                         if(is_array($refundImages) || $refundImages instanceof \think\Collection || $refundImages instanceof \think\Paginator): $i = 0; $__LIST__ = $refundImages;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$img): $mod = ($i % 2 );++$i;if($img): ?>
                            <div class="img-box" style="display: inline-block; margin-right: 10px;">
                                <img src="<?php echo htmlentities((string) trim($img)); ?>" alt="退款理由图片" style="width: 100px; height: 100px; object-fit: cover;">
                            </div>
                            <?php endif; ?>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    <?php endif; ?>
                </div>
            </div>


            <!-- 订单操作 -->
            <div class="section-title"><i></i> 订单管理</div>
            <div class="action-btns" style="border-top: 1px solid #ebeef5;">
                <button class="layui-btn"  id="addRemarkBtn">订单备注</button>
                <?php if($order['paid'] == 1): ?>
                        <button class="layui-btn" id="refundBtn">退款</button>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="refundTpl">
    <form class="layui-form" lay-filter="refundForm" style="padding: 20px;">
        <div class="layui-form-item">
            <label class="layui-form-label">退款金额</label>
            <div class="layui-input-block">
                <input type="number" name="refund_amount" lay-verify="required|number" 
                       value="<?php echo htmlentities((string) $order['pay_price']); ?>" placeholder="请输入退款金额" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">退款原因</label>
            <div class="layui-input-block">
                <textarea name="refund_reason" lay-verify="required" placeholder="请输入退款原因" class="layui-textarea"></textarea>
            </div>
        </div>
    </form>
</script>

<!-- 订单备注弹窗模板 -->
<script type="text/html" id="remarkTpl">
    <form class="layui-form" lay-filter="remarkForm" style="padding: 20px;">
        <div class="layui-form-item">
            <label class="layui-form-label">订单备注</label>
            <div class="layui-input-block">
                <textarea name="remark" placeholder="请输入订单备注内容" class="layui-textarea"><?php echo htmlentities((string) (isset($order['remark']) && ($order['remark'] !== '')?$order['remark']:'')); ?></textarea>
            </div>
        </div>
    </form>
</script>

	</main>
</body>
<script  src="/static/merchant/js/index.js"></script>
<script src="/static/merchant/js/base.js"></script>
 
<script>
    changeTitleName('订单退款');
    
    layui.use(['form', 'layer'], function(){
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.$;

        // 退款操作
        $('#refundBtn').on('click', function(){
            layer.open({
                type: 1,
                title: '订单退款',
                content: $('#refundTpl').html(),
                area: ['500px', '300px'],
                btn: ['确认退款', '取消'],
                success: function(layero, index){
                    form.render();
                },
                yes: function(index, layero){
                    var refund_amount = layero.find('input[name="refund_amount"]').val();
                    var refund_reason = layero.find('textarea[name="refund_reason"]').val().trim();
                    
                    if(!refund_amount){
                        layer.msg('请输入退款金额');
                        return false;
                    }
                    if(!refund_reason){
                        layer.msg('请输入退款原因');
                        return false;
                    }

                    // 提交退款请求
                    $.post('/merchant/merchant-order-refund', {
                        order_id: '<?php echo htmlentities((string) $order['order_id']); ?>',
                        refund_amount: refund_amount,
                        refund_reason: refund_reason
                    }, function(res){
                        if(res.code === 200){
                            layer.msg('退款申请已提交', {icon: 1});
                            setTimeout(function(){
                                location.reload();
                            }, 1000);
                        }else{
                            layer.msg(res.msg || '退款失败', {icon: 2});
                        }
                    });
                }
            });
        });

        // 订单备注
        $('#addRemarkBtn').on('click', function(){
            layer.open({
                type: 1,
                title: '订单备注',
                content: $('#remarkTpl').html(),
                area: ['500px', '250px'],
                btn: ['保存备注', '取消'],
                success: function(layero, index){
                    form.render();
                },
                success: function(layero, index){
                    form.render();
                },
                yes: function(index, layero){
                    var remark = layero.find('textarea[name="remark"]').val().trim();
                    
                    // 提交备注请求
                    $.post('/merchant/merchant-order-remark', {
                        order_id: '<?php echo htmlentities((string) $order['order_id']); ?>',
                        remark: remark
                    }, function(res){
                        if(res.code === 200){
                            layer.msg('备注已保存', {icon: 1});
                            layer.close(index);
                        }else{
                            layer.msg(res.msg || '保存失败', {icon: 2});
                        }
                    });
                }
            });
        });
    });
</script>
>
</html>